package ooday04;

import ooday03.Swim;

public class Text {
    public static void main(String[] args) {
//        Dog cc=new Dog("王小明",12,"蓝色");
//        cc.eat();
//        cc.drink();
//        cc.swim();
//        Chick chick=new Chick("ikun",25,"黑色");
//        chick.eat();
//        chick.drink();
//        chick.upeggs();
//        Fish fish=new Fish("双面龟",66,"绿色");
//        fish.eat();
//        fish.drink();
//        Dog []dogs=new Dog[3];
//        dogs[0]= new  Dog("小胖",12,"蓝色");
//        dogs[1]= new  Dog("小瘦",13,"黑色");
//        dogs[2]= new  Dog("肥波",14,"棕色");
//        Chick[] chicks=new Chick[2];
//        chicks[0]=new Chick("ikun",22,"黑色");
//        chicks[1]=new Chick("鸡哥",23,"白色");
//        Fish[]fish=new Fish[2];
//        fish[0]=new Fish("鬼哥",33,"蓝色");
//        fish[1]=new Fish("小帅",44,"黄色");
//        for(int i=0;i< dogs.length;i++){
//            System.out.println(dogs[i].name);
//            dogs[i].eat();
//            dogs[i].swim();
//        }
//        for (int i=0;i< chicks.length;i++){
//            System.out.println(chicks[i].name);
//            chicks[i].drink();
//            chicks[i].upeggs();
//        }
//        for(int i=0;i< fish.length;i++){
//            System.out.println(chicks[i].name);
//            chicks[i].drink();
//        }
//    }
    Animal []animals=new Animal[4];
    animals[0]=new Dog("小明",11,"蓝色");
    animals[1]=new Chick("小x",11,"蓝色");
    animals[2]=new Fish("小y",11,"蓝色");
    animals[3]=new Chick("小z",11,"蓝色");
        for(int i=0;i< animals.length;i++){
            System.out.println(animals[i].name);
            animals[i].eat();
            animals[i].drink();
        }
        animals[4]=new Dog("小明",11,"蓝色");
        for(int i=0;i< animals.length;i++) {
            System.out.println(animals[i].name);

            if (animals[i] instanceof Dog) {
               Dog dog=(Dog) animals[i];
               dog.lookHome();
            }

            if (animals[i] instanceof Chick) {
                Chick chick=(Chick) animals[i];
                chick.upeggs();
            }
            if (animals[i] instanceof Swim) {
                Swim swim=(Swim) animals[i];

            }
        }
    }
//
//        Master master=new Master();
//        Dog dog=new Dog("皇子",45,"蓝色");
//        Chick chick =new Chick("蓝格",10,"蓝色");
//        Fish fish=new Fish("晖哥",22,"灰色");
//        master.feed(dog);
//        master.feed(chick);
//        master.feed(fish);
//




    }

